using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FileSystem : IDataReader, IJsonMapper
{
    public string ReadData(string path)
    {
        return Resources.Load<TextAsset>(path).text;
    }

    public T ToObject<T>(string json)
    {
        return JsonUtility.FromJson<T>(json);
    }

    public T FileToObject<T>(string path)
    {
        string json = ReadData(path);
        return ToObject<T>(json);
    }

    public AudioClip LoadAudioClip(string path)
    {
        return Resources.Load<AudioClip>(path);
    }

    public Sprite LoadSprite(string path)
    {
        return Resources.Load<Sprite>(path);
    }
}
